package com.xinweisi.dataserver.timertask;

import com.xinweisi.dataserver.constant.Enumeration;
import com.xinweisi.dataserver.third.RedisService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @author lijie1
 * @date 2020/7/7 0007
 */
@Data
@Slf4j
@Component
public class RedisClear {
    private static RedisService redisService;
    @Autowired
    public void setRedisService(RedisService redisService) {
        this.redisService = redisService;
    }

    public static void clearRedis(){
        redisService.del(Enumeration.YESTERDAY_NEW_USERS_KEY);
        redisService.del(Enumeration.YESTERDAY_ACTIVE_USERS_KEY);
        redisService.del(Enumeration.YESTERDAY_ON_LINE_USERS_KEY);
        redisService.del(Enumeration.THREE_DAY_NEW_USERS_KEY);
        redisService.del(Enumeration.THREE_DAY_ACTIVE_USERS_KEY);
        redisService.del(Enumeration.THREE_DAY_ON_LINE_USERS_KEY);
        redisService.del(Enumeration.USER_KEY);
        redisService.deleteByPrex("Behavior*");
        redisService.deleteByPrex("TradeFlow*");
    }
}
